package simple.engine.common;

public class SimpleUtils {
	static public int nextPowerOfTwo(int value) {
		  if (value == 0)
		   return 1;
		  if ((value & value - 1) == 0)
		   return value;
		  value |= value >> 1;
		  value |= value >> 2;
		  value |= value >> 4;
		  value |= value >> 8;
		  value |= value >> 16;
		  return value + 1;
	 }

	 static public boolean isPowerOfTwo(int value) {
		 return value != 0 && (value & value - 1) == 0;
	 }
	 
}
